<template>

    <el-card>
      <div class="greet">
        <el-avatar :src="'/img/avatar.webp'" :size="60"></el-avatar>
        <div class="greet-text">
          欢迎回来，aaa，你可能有些累了，喝杯咖啡提提神吧
        </div>
      </div>

    </el-card>
    <div class="divider"></div>
    <el-card >
      <template #header>最热视频</template>
      <el-carousel :interval="4000" type="card" height="180px">
        <el-carousel-item v-for="item in hotVideoList" :key="item.videoId">
          <el-image :src="item.videoCover" style="height: 100%;width: 100%" fit="cover"></el-image>
        </el-carousel-item>
      </el-carousel>
    </el-card>
  <div class="divider"></div>
  <el-card>
    <template #header>视频数据</template>
    <el-row :gutter="20">
      <el-col :span="8">
        <div class="data-item">
          <div class="top">视频总数</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="data-item">
          <div class="top">评论</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="data-item">
          <div class="top">弹幕</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
    </el-row>
    <div class="divider"></div>
    <el-row :gutter="20">
      <el-col :span="8">
        <div class="data-item">
          <div class="top">点赞</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="data-item">
          <div class="top">分享</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="data-item">
          <div class="top">收藏</div>
          <div class="bottom">0</div>
        </div>
      </el-col>
    </el-row>
  </el-card>



</template>

<script setup>
import {onMounted, ref} from "vue";
import {getHotVideos} from "@/api/api.js";

const hotVideoList = ref([])
onMounted(async ()=> {
  let res = await getHotVideos();
  hotVideoList.value = res.data
})
</script>

<style scoped lang="scss">
.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

.divider{
  height: 10px;
}

.greet{
  display: flex;
  align-items: center;
  .greet-text{
    margin-left: 30px;
    color: black;
    font-weight: bold;
  }
}

.data-item{
  width: 100%;
  height: 80px;
  background-color: #c9c9ff;
  border-radius: 10px;
  padding: 15px;
  box-sizing: border-box;
}
</style>